#encoding=utf-8
import os

class SetElements():

    def get_name(self,name,driver):
        try:
            element=driver.find_element_by_name(name)
            return element
        except Exception as e:
            print("未找到name为%s的元素"%(name))

    def get_xpath(self,xpath,driver):
        try:
            element = driver.find_element_by_xpath(xpath)
            return element
        except Exception as e:
            print("未找到xpath为%s元素"%(xpath))

    #使用adb输入，可以试下使用set_text()输入
    def fast_input(self,text):
        adb='adb shell input text %s'%text
        os.system(adb)

    #判断是否选中
    def is_selected(self,xpath,driver):
        type=driver.find_element_by_xpath(xpath).is_selected()
        return type





